package com.raulraja.persistence;

import com.raulraja.model.domain.PersistentObject;

import java.io.Serializable;

/**
 * A generic interface for persistence operations
 * The PersistenceAdapter is responsible for persisting and retrieving PersistentObjects from a data store.
 * The PersistenceAdapter implements the basic CRUD and querying operations to operate with a DB, LDAP...
 */
public interface PersistenceAdapter<T extends PersistentObject> {

	/**
	 * Finds a persistent object in the data store based on its id
	 * @param entityClass the persistent object class
	 * @param id the persistent object unique identifier
	 * @return the persistent object if found
	 */
	T findById(Class<T> entityClass, Serializable id);

}
